import request from '@/utils/request'


// 生成箱码号
export function generateBoxCode() {
  return request({
    url: '/purchase/boxCodes/generateBoxCode',
    method: 'get'
  })
}

// 生成批次号
export function generateBatchCode() {
  return request({
    url: '/purchase/boxCodes/generateBatchCode',
    method: 'get'
  })
}

// 生成箱码
export function generateBoxCodes(data) {
  return request({
    url: '/purchase/boxCodes/generate',
    method: 'post',
    data: data
  })
}

// 查询采购订单列表
export function listPurchaseOrders(query) {
  return request({
    url: '/purchase/purchaseOrders/list',
    method: 'get',
    params: query
  })
}

// 根据采购订单号和存货编码获取详情
export function getPurchaseOrders(id,itemId) {
  return request({
    url: '/purchase/purchaseOrders/' + id+'/'+itemId,
    method: 'get'
  })
}

// 根据采购订单号和存货编码获取详情
export function getPurchaseOrdersDetailInfo(id,itemId) {
  return request({
    url: '/purchase/purchaseOrders/detailInfo/' + id+'/'+itemId,
    method: 'get'
  })
}

// 新增采购订单
export function addPurchaseOrders(data) {
  return request({
    url: '/purchase/purchaseOrders',
    method: 'post',
    data: data
  })
}

// 修改采购订单
export function updatePurchaseOrders(data) {
  return request({
    url: '/purchase/purchaseOrders',
    method: 'put',
    data: data
  })
}

// 删除采购订单
export function delPurchaseOrders(id) {
  return request({
    url: '/purchase/purchaseOrders/' + id,
    method: 'delete'
  })
}

// 批量删除采购订单详情
export function batchdelPurchaseOrders(ids) {
  return request({
    url: `/purchase/purchaseOrders/batch/${ids}`,
    method: 'delete'
  })
}

// 生成采购订单号
export function generatePoId() {
  return request({
    url: '/purchase/purchaseOrders/generatePoId',
    method: 'get'
  })
}
